<html>
	<body>
		<p>Hi, {{ r.name|default_if_none:'' }}</p>
		<p>Here is the Weekly Report from <b style="color: red">{{ monday }}</b> to <b style="color: red">{{ sunday }}</b> on PTS:</p>
		<div style="margin: 0 auto;padding: 40px;max-width: 800px;">
		  
		  {% for m in data_group %}
			  <div style="margin: 0 0 40px 0;width: 100%;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);display: table;">
			    
			    <div style="display: table-row;font-weight: 900;color: #ffffff;background: {% with counter=forloop.counter %}{% if counter == 1 %}#27ae60{% elif counter == 2 %}rgb(254, 167, 0){% else %}#ea6153{% endif %}{% endwith %};">
			      <div style="padding: 6px 12px;display: table-cell;">
			        {{ m.label }} ({{ m.count }})
			      </div>
			      <div style="padding: 6px 12px;display: table-cell;"> </div>
			      <div style="padding: 6px 12px;display: table-cell;"> </div>
			    </div>
			    
			    {% for v in m.data %}
				    <div style="display: table-row;background: {% if forloop.counter|divisibleby:2 %}#e9e9e9{% else %}#f6f6f6{% endif %};">
				      <div style="padding: 6px 12px;display: table-cell;">
				      	<a target="_blank" href="http://{{ domain }}/admin/app_info/app/{{ v.app_id }}/#version">
					        {{ v.app.prj_code }}
				      	</a>
				      </div>
				      <div style="padding: 6px 12px;display: table-cell;">
				        {{ v.app.app_name }}
				      </div>
				      <div style="padding: 6px 12px;display: table-cell;">
				        V{{ v.code }}
				      </div>
				    </div>
			    {% endfor %}
			    
			  </div>
		  {% endfor %}
		  {% comment "heyulin 2016-3-24 because echo need take away this block" %}
			<div style="margin: 0 0 40px 0;width: 100%;box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);display: table;">
				<div style="display: table-row;font-weight: 900;color: #ffffff;background:#2980b9;">
					<div style="padding: 6px 12px;display: table-cell;">WIP</div>
					{% for t in teams %}
						<div style="padding: 6px 12px;display: table-cell;">
							{{ t }}
						</div>
					{% endfor %}
				</div>
				<div style="display: table-row;background: #f6f6f6;">
					<div style="padding: 6px 12px;display: table-cell;">Total</div>
					{% for s in summary %}
						<div style="padding: 6px 12px;display: table-cell;"><b>{{ s }}</b></div>
					{% endfor %}
				</div>
				{% for m in metrics %}
					<div style="display: table-row;background: {% if forloop.counter|divisibleby:2 %}#e9e9e9{% else %}#f6f6f6{% endif %};">
						<div style="padding: 6px 12px;display: table-cell;"><b>{{ m.label }}</b></div>
						{% for n in m.sum %}
							<div style="padding: 6px 12px;display: table-cell;">{{ n }}</div>
						{% endfor %}
					</div>
					{% for i in m.data %}
						<div style="display: table-row;background: {% if forloop.parentloop.counter|divisibleby:2 %}#e9e9e9{% else %}#f6f6f6{% endif %};">
							<div style="padding: 6px 12px;display: table-cell;text-align: right;">{{ i.label }}</div>
							{% for v in i.value %}
								<div style="padding: 6px 12px;display: table-cell;">{{ v }}</div>
							{% endfor %}
						</div>
					{% endfor %}
				{% endfor %}
			</div>
			{% endcomment %}
			
		</div>
	</body>
</html>